return;
}
+void
+handle_breakpoint_requests (char *own_buf, char *status, unsigned char *signal)
+{
+ /* Currently we only support software breakpoints */
+ switch (own_buf[1]) {
+ case '0': /* software breakpoint, int3 based */
+ own_buf[0] = '\0';
+ break;
+ case '1': /* hardware breakpoint */
+ default:
+ write_enn (own_buf);
+ break;
+ }
+}
+
void
myresume (int step, int sig)
{
"HOST:PORT to listen for a TCP connection.\n");
}
+extern control_c_pressed_flag;
+#include <signal.h>
+
+void ctrl_c_handler(int signo)
+{
+ printf("Ctrl-C pressed: Quit from the attached gdb first\n");
+ control_c_pressed_flag = 1;
+}
+
+struct sigaction ctrl_c_sigaction = { .sa_handler = ctrl_c_handler };
+struct sigaction old_sigaction;
+
int
main (int argc, char *argv[])
{
}
}
+
while (1)
{
remote_open (argv[1]);
+ sigaction(SIGINT, &ctrl_c_sigaction, &old_sigaction);
restart:
setjmp (toplevel);
/* Extended (long) request. */
handle_v_requests (own_buf, &status, &signal);
break;
+ case 'Z':
+ handle_breakpoint_requests (own_buf, &status, &signal);
+ break;
default:
/* It is a request we don't understand. Respond with an
empty packet so that gdb knows that we don't support this
"GDBserver will reopen the connection.\n");
remote_close ();
}
+ sigaction(SIGINT, &old_sigaction, NULL);
}
}
return map_domain_va_32(xc_handle, cpu, guest_va, perm);
}
+int control_c_pressed_flag = 0;
+
static int
__xc_waitdomain(
int xc_handle,
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = domain;
-
retry:
retval = do_dom0_op(xc_handle, &op);
if ( retval || (op.u.getdomaininfo.domain != domain) )
if ( options & WNOHANG )
goto done;
+ if (control_c_pressed_flag) {
+ xc_domain_pause(xc_handle, domain);
+ control_c_pressed_flag = 0;
+ goto done;
+ }
+
if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) )
{
nanosleep(&ts,NULL);
goto retry;
}
- /* XXX check for ^C here */
done:
if (get_online_cpumap(xc_handle, &op.u.getdomaininfo, &cpumap))
printf("get_online_cpumap failed\n");
break;
}
+ case TRAP_int3:
+ {
+ if ( test_bit(_DOMF_debugging, &v->domain->domain_flags) )
+ domain_pause_for_debugger();
+ else
+ vmx_inject_exception(v, TRAP_int3, VMX_DELIVER_NO_ERROR_CODE);
+ break;
+ }
#endif
case TRAP_no_device:
{